home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 40 / Issue 40.iso / pc / PCSoftware / NoteTab Pro 2.83 / setup.exe / Main / D: / Prod / SetUp / NoteTab / Libraries / SampleCode.clb < prev    next >
Encoding:
Text File  |  2000-10-26  |  21.1 KB  |  593 lines

  1. = V5 MultiLine NoSorting TabWidth=30
  2.  
  3. H=";About this library"
  4. This library was written by Fookes Software to serve as a demonstration of the varied tasks that can be performed by the Editor Clipbook. It contains various items that illustrate how certain Clip commands and functions can be used. Most of these Clips do not really provide useful functions, but they can help you understand how to create your own Clips. We recommend that you look at the Clip code and compare it with what happens when you activate it.
  5.  
  6. If you have a useful Clipbook library that you would like to share with other NoteTab users, please submit it to: <clipbook@notetab.com>. Your library will then be added to the Clipbook repository on the web.
  7. on the web.
  8.  
  9.  
  10. H=";"
  11.  
  12.  
  13. H=";Launching Programs"
  14.  
  15.  
  16. H="Batch example"
  17. ^!Continue This Clip will first launch the Windows calculator; once you close it, MS Wordpad will be opened. Continue?
  18. ;Launches the calculator utility and waits until the user closes it
  19. ^!ShellWait calc.exe
  20. ;Launches the Wordpad program
  21. ^!Shell Wordpad.exe ^$GetShort("^##")$
  22.  
  23. H="Shortcut example"
  24. ;Executes application associated with the shortcut
  25. ^!Prompt This Clip example will only work if you have a shortcut labeled "Explorer" pointing to Windows Explorer on your Desktop.
  26. ^!Shell c:\windows\desktop\explorer.lnk
  27.  
  28. H="Send E-Mail"
  29. ;Demonstrates the ^!EMail command
  30. ^!EMail ^?[E-mail address];^?[E-mail subject=^&]^?[Copy text from active document to E-mail body?=_Yes^=;+|No^=;]
  31.  
  32. H="Launch Document"
  33. ;Opens the current document in its associated application (for example .html file opens in default browser). A temporary copy of the document is made if it wasn't saved before using the "^**" instruction
  34. ^!Shell ^**
  35.  
  36. H=";"
  37.  
  38.  
  39. H=";Updating INI options"
  40.  
  41.  
  42. H="1. ProgIniSave"
  43. ;Saves current settings to the "Test.ini" file in the NoteTab program directory (default when no path is specified)
  44. ^!ProgIniSave Test.ini
  45.  
  46. H="2. ProgIniEdit"
  47. ;Check if the file "Test.ini" exists. If it does, skip the next instruction, otherwise create it and save the NoteTab settings to it
  48. ^!IfFileExist ^$GetAppPath$Test.ini Skip
  49. ;Saves current settings to the "Test.ini" file in the NoteTab program directory (default when no path is specified)
  50. ^!ProgIniSave Test.ini
  51. ;Open the "Test.ini" file in NoteTab
  52. ^!Open ^$GetAppPath$Test.ini
  53. ;Show message
  54. ^!Prompt Edit items in the Test.ini file, save the changes, and then activate on the Clip "3. ProgIniLoad" to update NoteTab option settings
  55.  
  56. H="3. ProgIniLoad"
  57. ;Update NoteTab settings with options contained in the "Test.ini" file
  58. ^!ProgIniLoad Test.ini
  59.  
  60. H=";"
  61.  
  62.  
  63. H=";Scripts"
  64.  
  65.  
  66. H="Perl script"
  67. ;Check if a Perl interpreter has been setup. If not, jump to the label NoPerl
  68. ^!IfFileExist ^$GetPerlExe$ Next ELSE NoPerl
  69. ;Delete the file "StdError.err" from the NoteTab program directory, if it exists
  70. ^!DeleteFile ^$GetAppPath$StdError.err
  71. ;Execute the Perl interpreter with the script contained in the Clip labeled "NumLines"
  72. ^!RunPerl Perl NumLines
  73. ;If the interpreter generated error messages, load them from the file "StdError.err" 
  74. ^!IfFileExist ^$GetAppPath$StdError.err Next ELSE End
  75. ^!Open ^$GetAppPath$StdError.err
  76. ^!Prompt Perl has reported some errors!
  77. ^!GoTo End
  78. :NoPerl
  79. ^!Prompt Cannot execute this Clip without a Perl interpreter!
  80.  
  81.  
  82. H="Gawk scripts"
  83. ;Thanks to Wayne M. VanWeerthuizen for the GAWK samples used by this Clip!
  84. ;Check if a Gawk interpreter has been setup. If not, jump to the label Error
  85. ^!IfFileExist ^$GetGawkExe$ Next ELSE Error
  86. ;Prompt user for the script to use with the Gawk interpreter and save answer in a variable
  87. ^!Set %ScriptName%=^?{(T=C)Choose GAWK script to modify document==_Reverse|Add Spaces}
  88. ;Abort this procedure if the Clip wizard was cancelled by the user
  89. ^!IfCancel Exit
  90. ;Execute the Gawk interpreter with the chosen script
  91. ^!RunGawk ^%ScriptName%
  92. ^!GoTo End
  93. :Error
  94. ^!Prompt Cannot execute this Clip without a GAWK interpreter!
  95.  
  96.  
  97. H="_Reverse"
  98. # Reverse text
  99. BEGIN { FS = "" }
  100. {
  101. for (i=NF;i>0;i--) printf("%s",$i);
  102. printf("\n");
  103. }
  104.  
  105.  
  106.  
  107. H="_Add Spaces"
  108. # Add spaces
  109. BEGIN { FS = "" }
  110. {
  111. for (i=1;i<NF;i++) printf("%s ",$i);
  112. printf("%s\n",$NF);
  113. }
  114.  
  115.  
  116.  
  117. H="_Perl NumLines"
  118. #
  119. #† \perl\numline.pl
  120. #
  121. # begin
  122. while (<>) {
  123.     $x=sprintf("%05d",$.);
  124.     print "$x $_";
  125. }
  126. # end
  127.  
  128.  
  129. H=";"
  130.  
  131.  
  132. H=";Keyboard Macros"
  133.  
  134.  
  135. H="Show text statistics"
  136. ;Press key combination Alt+T, followed by the letter S, followed by a delay of 400 milliseconds to give the dialog box time to open, followed by the letter M
  137. ^!Keyboard ALT+T S &400 M
  138.  
  139. H="Open AutoExec.bat"
  140. ;Set delay of approximately 200 milliseconds between each keystroke
  141. ^!KeyboardDelay 200
  142. ;Press key combination Ctrl+O (opens the File Open dialog box), followed by the text "c:\autoexec.bat", followed by the Enter key (to close the dialog box)
  143. ^!Keyboard CTRL+O #c:\autoexec.bat# ENTER
  144.  
  145. H="Use Windows Calculator"
  146. ;The following script shows how you can send keys to another program
  147.  
  148. ;Check if the calculator program is open. Jumpt to BringToFront label if found
  149. ^!IfAppOpen Calculator BringToFront ELSE Next
  150. ;Calculator program was not open, so now we launch it
  151. ^!Shell Calc.exe
  152. ;give it enough time to load (4/10th of a second)
  153. ^!Delay 4
  154.  
  155. :BringToFront
  156. ;Bring Calculator program to the front
  157. ^!FocusApp Calculator
  158.  
  159. :PressKeys
  160. ;Add all numbers from 1 to 9 and then activate the equal button with the ENTER key
  161. ;Set delay of approximately 200 milliseconds between each keystroke
  162. ^!KeyboardDelay 200
  163. ;Send keystrokes to the calculator utility
  164. ^!Keyboard #1+2+3+4+5+6+7+8+9# ENTER
  165.  
  166.  
  167. H=";"
  168.  
  169.  
  170. H=";Wizard Fields"
  171.  
  172.  
  173. H="Remember variable"
  174. ;Show message
  175. ^!Info This Clip shows you how variables can be used in the Clip wizard and reused as default values in the dialog box's fields. The value of the variables will be inserted into the current document (unless you cancel the Clip wizard). The Clip wizard will be displayed repeatedly until you click on the Cancel button.
  176. ;Place cursor at the end of the document
  177. ^!Jump TEXT_END
  178.  
  179. :StartLoop
  180. ;Show Clip wizard with two fields. Each receives the default value contained in the variable following the label's equal sign
  181. ^!Set %p_FName%=^?{First Name=^%p_FName%}; %p_LName%=^?{Last Name=^%p_LName%}
  182. ;Abort this procedure if the Clip wizard was cancelled by the user
  183. ^!IfCancel Exit
  184. ;Insert text and variable content into document
  185. First Name: ^%p_FName%
  186. Last Name:  ^%p_LName%
  187.  
  188.  
  189. ;Jump back to the start of the loop
  190. ^!Goto StartLoop
  191.  
  192. H="Remember default value"
  193. ;Create a new document
  194. ^!ToolBar New Document
  195.  
  196. ;If the variable ValueList is not empty, skip the next instruction
  197. ^!IfFalse ^$IsEmpty(^%ValueList%)$ Skip
  198. ;Assign a list of values to the variable ValueList
  199. ^!Set %ValueList%=_1|2|3|4|5|6
  200.  
  201. ;Beginning of loop
  202. :StartLoop
  203. ;Promp user to select a value from the list in the Clip wizard
  204. ^!Set %DefaultValue%=^?{Choose or enter a new default value=^%ValueList%}
  205. ;Insert the chosen value in the document, followed by a line break
  206. ^!SetPasteIndent Off
  207. ^!InsertText Default value = ^%DefaultValue%^p
  208. ;Change the default-value marker to match the item chosen by the user
  209. ^!Set %ValueList%=^$SetDefaultValue(^%ValueList%;^%DefaultValue%)$
  210. ;Prompt user to continue or end Clip
  211. ^!Continue Continue demonstration?
  212. ;Jump back to the start of the loop
  213. ^!Goto StartLoop
  214.  
  215. H="Play sound"
  216. ;Show Clip wizard with choice of system sounds, then play chosen sound
  217. ^!Sound ^?[Play Sound=SystemAsterisk|_SystemExclamation|SystemHand|SystemQuestion|SystemDefault]
  218.  
  219. H="Open multiple files"
  220. ;Sample code for displaying a Clip wizard with a File Open field "T=O", with possibility of selecting multiple files "S=M"
  221. ^!Open ^?[(T=O;S=M;F="Text Files (*.txt;*.ini)|*.txt;*.ini")Prompt]
  222.  
  223. H="Insert HRef link"
  224. ;Sample code for displaying a Clip wizard with a URL-tag field (T=T), and file filters matching HTML documents
  225. ^!InsertHtml <A ^?[(T=T;F="HTML Files|*.*htm*;*.asp;*.css")Link to web page]>^?[Link text=^&]</A>
  226.  
  227. H="Multiple fields"
  228. ;Show message
  229. ^!Continue This Clip will demonstrate various Wizard field types. The resulting output will be inserted into the current document. Continue?
  230. ;Create a new document
  231. ^!ToolBar New Document
  232. ;Display Clip wizard with various types of fields
  233. ^?[(T=W)&Memo Field with word wrap=This default text has^pseveral lines^p thanks to the use of^ptokens]
  234. ^?[&Prompt=List1^=Hello World^PMy name is Eric|List2^=Value2^Twith a tab|List3^=Three^pLines^Pfor you]
  235. ^?[(T=O;F="Text Files|*.txt;*.ini;*.*htm*")&Browse Field #1=c:\Windows\]
  236. <A ^?[(T=T;F="HTML Files|*.*htm*;*.asp;*.css")&Link to web page=c:\html\]>^?[Link &text=^&]</A>
  237. <IMG ^?[(T=T;C=L;F="Image Files|*.gif;*.jpg;*.jpeg")Link to &image=c:\html\] BORDER=0 ALT="^?[&Alt=^&]">
  238. ^?[(T=M;S=400;H=8)M&emo Field without word wrap]
  239. ^?[(M=">LL00;0;*")Mas&k Field]
  240.  
  241.  
  242. H="Insert file"
  243. ;Sample Clip demonstrating a prompt for inserting a file in the current document
  244. ^!InsertFile ^?{(T=O;F="Text Files|*.txt;*.ini;*.*htm*")Enter file name to insert=^$GetWinPath$}
  245.  
  246. H=";"
  247.  
  248.  
  249. H=";Arrays and Checkboxes"
  250.  
  251.  
  252. H="SetArray demo 1"
  253. ;Assign semicolon-delimited values to array variable
  254. ^!SetArray %Month%=January;February;March;April;May;June;July;August;September;October;November;December
  255. ;Prompt user to choose a month number
  256. ^!Set %MonthId%=^?[Choose a month number (1..12)=4]
  257. ;Show info window with month name corresponding to user's choice. The content of the array's indexed variable is used here
  258. ^!Info Month (#^%MonthId%) = ^%Month^%MonthId%%
  259.  
  260. H="SetArray demo 2"
  261. ;Assign semicolon-delimited values to array variable
  262. ^!SetArray %Names%=Cindy;Evelyn;Nicole
  263. ;Show content of array variable
  264. ^!Info 1. List of names:^P^P^%Names%
  265. ;Change the content of the second item in the array variable according to the user's input
  266. ^!Set %Names2%=^?{Change name #2=Kay}
  267. ;Show updated content of array variable
  268. ^!Info 2. List of names:^P^P^%Names%
  269.  
  270. H="SetArray demo 3"
  271. ;Assign all the file names chosen by the user into an array variable
  272. ^!SetArray %Files%=^?[(T=O;S=M;F="Text Files (*.txt;*.ini)|*.txt;*.ini")You can select several files]
  273. ;Copy the value representing the number of items into the Count variable. The variable at index 0 indicates the number of items in the array
  274. ^!Set %Count%=^%Files0%
  275. ;Initialize the Index variable to 0
  276. ^!Set %Index%=0
  277.  
  278. ;Beginning of loop
  279. :StartLoop
  280. ;Add one to the value contained in the variable Index
  281. ^!Inc %Index%
  282. ;End the Clip if the Index number is greater than the Count number
  283. ^!If ^%Index% > ^%Count% End
  284. ;Show the file name corresponding to the current index value. The content of the array's indexed variable is used here
  285. ^!Prompt File #^%Index% = ^%Files^%Index%%
  286. ;Jump back to the start of the loop
  287. ^!Goto StartLoop
  288.  
  289. H="SetListDelimiter"
  290. ;Define a list delimiter as two successive line breaks
  291. ^!SetListDelimiter ^p^p
  292. ;Loads all the text in the current document into the array variable. Each section of text separated by a blank line will be stored in its own indexed variable
  293. ^!SetArray %Array%=^$GetText$
  294. ;Prompt the user for a paragraph index number
  295. ^!Set %ParaIndex%=^?[Display paragraph #=4]
  296. ;Display the corresponding paragraph text in an info window
  297. ^!Info Paragraph (#^%ParaIndex%) = ^%NL%^%Array^%ParaIndex%%
  298.  
  299.  
  300. H=";----"
  301.  
  302.  
  303. H="CheckBoxes demo 1"
  304. ;Display checkbox list with Value2 and Value4 checked by default
  305. ^!Info ^?[(T=A)Prompt=Value1|_CheckedValue2|Value3|_CheckedValue4|Value5]
  306.  
  307. H="CheckBoxes demo 2"
  308. ;Change default delimiter to a blank space
  309. ^!SetListDelimiter " "
  310. ;Display checkbox list with Value2 and Value4 checked by default. The list displays a text that is different from the actual values
  311. ^!Info ^?{(T=A)Prompt=Value1^=V1|_CheckedValue2^=V2|Value3^=V3|_CheckedValue4^=V4|Value5^=V5}
  312.  
  313. H=";"
  314.  
  315.  
  316. H=";Loops"
  317.  
  318.  
  319. H="Loop demo 1"
  320. ;Demonstrates how loops can be created in Clip syntax
  321. ^!Continue This demonstrates Clip looping...
  322. ;Create a new document
  323. ^!ToolBar New Document
  324.  
  325. ;Beginning of loop
  326. :Start
  327. ;Insert text in document
  328. Paste Me!
  329.  
  330. ;Display prompt to user. If user confirms, next instruction is skipped
  331. ^!Skip Paste again?
  332. ;Ends Clip
  333. ^!GoTo End
  334. ;Jump back to the start of the loop
  335. ^!GoTo Start
  336.  
  337. H="Loop demo 2"
  338. ;Demonstrates how loops can be created in Clip syntax
  339. ^!Continue This demonstrates Clip looping...
  340. ;Create a new document
  341. ^!ToolBar New Document
  342. ;Copy value returned by Clip wizard to a variable
  343. ^!Set %Counter%=^?[Repeat count]
  344.  
  345. ;Beginning of loop
  346. :Start
  347. ;Test if value contained in variable is less than 1. End Clip if it is.
  348. ^!If ^%Counter% < 1 End
  349. ;Substract one from the value contained in the Counter variable
  350. ^!Dec Counter
  351. ;Insert text in document
  352. Paste Me!
  353.  
  354. ;Jump back to the start of the loop
  355. ^!GoTo Start
  356.  
  357. H="Address database"
  358. ;Creates a CSV list of address information
  359. ;Places cursor at the end of the text
  360. ^!Jump TEXT_END
  361.  
  362. ;Beginning of loop
  363. :Start
  364. ;Ask if user wants to add another address. End Clip if not
  365. ^!Continue Add an address?
  366. ;Display Clip wizard with address fields
  367. "^?{First Name}","^?{Last Name}","^?{Address 1}","^?{Address 2}","^?{City}","^?{State/Province}","^?{ZIP/Postal Code}","^?{Country}","^?{Phone}","^?{Fax}"
  368.  
  369. ;Jump back to the start of the loop
  370. ^!Goto Start
  371.  
  372. H="Loop tabs demo 1"
  373. ;Activates the first document in the tab bar
  374. ^!Document First
  375.  
  376. ;Beginning of loop
  377. :Start
  378. ;Ask if user wants to continue Clip
  379. ^!Continue Next document is now current. Continue?
  380. ;Activates the next document in the tab bar
  381. ^!Document Next
  382. ;End Clip if an error condition was generated (i.e. no more documents after the current one)
  383. ^!IfError End
  384. ;Jump back to the start of the loop
  385. ^!GoTo Start
  386.  
  387. H="Loop tabs demo 2"
  388. ;Initialize variable Index to 0
  389. ^!Set %Index%=0
  390.  
  391. ;Beginning of loop
  392. :LoopStart
  393. ;Add one to the value contained in the Index variable
  394. ^!Inc %Index%
  395. ;End Clip if the value contained in Index is greater to the number of open documents
  396. ^!If ^%Index% > ^$GetDocCount$ End
  397. ;Activate the specified document
  398. ^!SetDocIndex ^%Index%
  399. ;Ask if user wants to continue Clip
  400. ^!Continue Document changed (Index = ^%Index%). Continue?
  401. ;Jump back to the start of the loop
  402. ^!GoTo LoopStart
  403.  
  404. H=";"
  405.  
  406.  
  407. H=";Delimited Text"
  408. Demonstrates how NoteTab can be used to search and process text in delimited (tab, comma, or other) data files
  409.  
  410.  
  411. H="Copy field"
  412. ^!Continue This Clip will open a tab-delimited file and select the field that matches the specified coordinates. Continue?
  413. ;Opens file "Data.txt" in the Samples subdirectory
  414. ^!Open ^$GetSamplesPath$Data.txt
  415. ;Prompts user for field index to select, then copies field to the Clipboard
  416. ^!SetClipboard ^$GetField(^?[Row=13];^?[Column=2])$
  417.  
  418. H="Search fields"
  419. ^!Continue This Clip will open a tab-delimited file and select the field that matches the specified search criteria. Continue?
  420. ;Opens file "Data.txt" in the Samples subdirectory
  421. ^!Open ^$GetSamplesPath$Data.txt
  422. ;Copies the line count number to a variable
  423. ^!Set %MaxRow%=^$GetLineCount$
  424. ;Initialize variable Row to 0
  425. ^!Set %Row%=0
  426. ;Prompt user for field delimiter used in document (the sample file Data.txt uses tabs)
  427. ^!SetDelimiter ^?[(6;T=C)Field Delimiter==_Tab^=^t|Semi-colon^=;|Equal sign^==|SDF^="";""|None^=]
  428.  
  429. ;Beginning of loop
  430. :LoopStart
  431. ;Add one to the value contained in the Index variable
  432. ^!Inc %Row%
  433. ;End Clip if value contained in Row is greater than the value contained in MaxRow (i.e. Number of lines in document)
  434. ^!If ^%Row% > ^%MaxRow% End
  435. ;Prompt user for search criteria and store matched text position in variable
  436. ^!Set %Pos%=^$GetPosInField(^%Row%;^?[(2)Column=2];^?[(3)Whole word=_Yes^=|No^=T]^?[(4)Ignore case=_Yes^=I|No^=]^?[(5)Criteria must match...=Start of field^=S|Whole field^=W|_Any part of field^=];"^?[(1)Search criteria=America]")$
  437. ;If the value stored in Pos is greater than 0 (we have a match), jump to the next instruction otherwise return to start of loop
  438. ^!If ^%Pos% > 0 Next ELSE LoopStart
  439. ;Move the input focus to the current document
  440. ^!FocusDoc
  441.  
  442. H="Copy data column"
  443. ^!Continue This Clip will open a tab-delimited file and copy all the fields from the specified column. Continue?
  444. ;Opens file "Data.txt" in the Samples subdirectory
  445. ^!Open ^$GetSamplesPath$Data.txt
  446. ;Empty the content of the Clipboard
  447. ^!SetClipboard ^%Empty%
  448. ;Copies the line count number to a variable
  449. ^!Set %MaxRow%=^$GetLineCount$
  450. ;Initialize variable Row to 0
  451. ^!Set %Row%=0
  452. ;Prompt user for field delimiter used in document (the sample file Data.txt uses tabs)
  453. ^!SetDelimiter ^?[(2;T=C)Field Delimiter==_Tab^=^t|Semi-colon^=;|Equal^==|SDF^="";""|None^=]
  454.  
  455. ;Beginning of loop
  456. :LoopStart
  457. ;Add one to the value contained in the Index variable
  458. ^!Inc %Row%
  459. ;End loop if value contained in Row is greater than the value contained in MaxRow (i.e. Number of lines in document)
  460. ^!If ^%Row% > ^%MaxRow% EndLoop
  461. ;Place cursor at beginning of line
  462. ^!SetCursor ^%Row%:1
  463. ;Add field matching the user-chosen column to the Clipboard with line break
  464. ^!SetClipboard ^$GetClipboard$^$GetField(^?[(1)Column to copy=2])$^%NL%
  465. ;Jump back to the start of the loop
  466. ^!GoTo LoopStart
  467.  
  468. :EndLoop
  469. ;Paste contents of the Clipboard into a new document
  470. ^!Toolbar Paste New
  471.  
  472. H=";"
  473.  
  474.  
  475. H=";Miscellaneous"
  476.  
  477.  
  478. H="Help on current word"
  479. ;Copy word under cursor into a variable
  480. ^!Set %Word%=^$GetWord$
  481. ;If the variable is empty (i.e. there was no word under the cursor), jump to the label ShowInfo
  482. ^!IfTrue ^$IsEmpty(^%Word%)$ ShowInfo
  483. ;Show topic matching keyword in NoteTab Help file
  484. ^!Help "" ^%Word%
  485. ;End Clip
  486. ^!Goto End
  487. :ShowInfo
  488. ^!Prompt First put the cursor on a word. This Clip will attempt to find a matching topic in the Help file
  489.  
  490. H="Open HTML template"
  491. ;Opens a template file for the creation of a web page
  492. ^!Open ^$GetTemplatePath$HTML.tpl
  493.  
  494. H="Get DOS output"
  495. ;Displays the output of the chosen DOS command to an info window
  496. ^!Info [L]^$GetDosOutput("^?[Dos output to display in Info window=dir c:\*.*]")$
  497.  
  498. H="Copy outline topics"
  499. ;If the current document is an outline, start the procedure. Otherwise ask whether to demonstrate the feature on the Readme.otl document, which is part of the NoteTab package
  500. ^!IfFalse ^$IsOutlineDoc$ OpenReadme
  501. ;Jump to the Start label
  502. ^!GoTo Start
  503.  
  504. :OpenReadme
  505. ;Open the Readme.otl document
  506. ^!Open ^$GetAppPath$Readme.Otl
  507. ;If there was an error while trying to open it, show message and end procedure
  508. ^!IfError Error
  509.  
  510. :Start
  511. ;Initialize variable TopicIndex to 0
  512. ^!Set %TopicIndex%=0
  513. ;Store the topics count in a variable
  514. ^!Set %TopicCount%=^$GetTopicCount$
  515. ;Empty the content of the Clipboard
  516. ^!SetClipboard ^%Empty%
  517.  
  518. :LoopStart
  519. ;Add one to the value contained in the TopicIndex variable
  520. ^!Inc %TopicIndex%
  521. ;Jump to PasteTopics label if TopicIndex is greater than TopicCount
  522. ^!If ^%TopicIndex% > ^%TopicCount% PasteTopics
  523. ;Make the outline topic that matches the value in TopicIndex active
  524. ^!SetTopicIndex ^%TopicIndex%
  525. ;Add the name of the active outline topic and a line break to the Clipboard
  526. ^!SetClipboard ^$GetClipboard$^$GetTopicName$^%NL%
  527. ;Jump back to the start of the loop
  528. ^!GoTo LoopStart
  529.  
  530. :Error
  531. ;Show error message
  532. ^!Prompt Error: the current document is not an outline
  533. ;End Clip
  534. ^!GoTo End
  535.  
  536. :PasteTopics
  537. ;Paste contents of the Clipboard into a new document
  538. ^!Toolbar Paste New
  539.  
  540. H="Open EBCDIC file"
  541. ;Prompts user to choose an EBCDIC file(s) and opens in NoteTab
  542. ^!OpenEbcdic ^?{(T=O;S=M;F="EBCDIC files (*.cbl;*.cob;*.cpy;*.ddl;*.bms)|*.cbl;*.cob;*.cpy;*.ddl;*.bms")Open EBCDIC file(s)=^$GetSamplesPath$Ebcdic.cob} /W=^?{LRECL=Variable Width^=0|80|_100|132|133}
  543.  
  544. H="Export document"
  545. ;Clip demonstrating the Export command
  546. ^!Export "^?[(T=S;F="Text Files|*.txt;*.ini;*.*htm*")File Name=c:\Temp\]" ^?[Character Set=ASCII|_ANSI] ^?[Format=_PC|MAC|UNIX|EBCDIC] ^?[Text=SELECTION|_ALL] ^?[Hard-break word wrap=_No^= |Yes^=HARDBREAKS]
  547.  
  548. H="NoteTab name and version"
  549. ;Clip functions to extract NoteTab program name and version
  550. ^!Info ^$GetProgName$ (version ^$GetProgVersion$)
  551.  
  552. H="Show paragraph"
  553. ;Demonstrates the GetParagraph function
  554. ^!Info ^$GetParagraph(^?[Display paragraph #=2])$
  555.  
  556. H="FarClip demo 1"
  557. ;Demonstrates the FarClip command. This will activate the Clip labeled "Center" in the HTML.clb library file
  558. ^!FarClip HTML:Center
  559.  
  560. H="FarClip demo 2"
  561. ;Demonstrates the FarClip command. This will activate the Clip labeled "Show Date" in the Samples\FarClips.dat library file
  562. ^!FarClip "^$GetSamplesPath$FarClips.dat:"Show Date""
  563.  
  564. H="Set bookmark"
  565. ;Check if editor type is NoteTab Light/Std. If it is, show error message (Bookmarks are only supported in NoteTab Pro)
  566. ^!IfSame ^$GetEditorType$ nts SntError
  567. ;Prompt user for bookmark number and set bookmark accordingly
  568. ^!SetBookmark ^?{Set Bookmark #=_1|2|3|4|5|6|7|8|9|0}
  569. ;Finish the Clip by jumping to the EndClip label
  570. ^!GoTo EndClip
  571.  
  572. :SntError
  573. ^!Prompt Sorry, bookmarks only work with NoteTab Pro!
  574.  
  575. :EndClip
  576. ;Move the input focus to the current document
  577. ^!FocusDoc
  578.  
  579. H="Go to bookmark"
  580. ;Check if editor type is NoteTab Light/Std. If it is, show error message (Bookmarks are only supported in NoteTab Pro)
  581. ^!IfSame ^$GetEditorType$ nts SntError
  582. ;Prompt user for bookmark number and move cursor to it if it exists
  583. ^!GotoBookmark ^?{Go to Bookmark #=_1|2|3|4|5|6|7|8|9|0}
  584. ;Finish the Clip by jumping to the EndClip label
  585. ^!GoTo EndClip
  586.  
  587. :SntError
  588. ^!Prompt Sorry, bookmarks only work with NoteTab Pro!
  589.  
  590. :EndClip
  591. ;Move the input focus to the current document
  592. ^!FocusDoc
  593.